package com.example.jetpack;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.example.jetpack.databinding.ActivityMainBinding;

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding binding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivityMainBinding.inflate(getLayoutInflater());
        View view = binding.getRoot();
        setContentView(view);
        binding.start.setOnClickListener(view1->{
            Intent intent = new Intent(this,MyService.class);
            startService(intent);
        });
        binding.stop.setOnClickListener(view1 -> {
            Intent intent = new Intent(this,MyService.class);
            stopService(intent);
        });
    }
}